package ex1;
import java.util.*;
import java.text.SimpleDateFormat;
public abstract class Employee {
	private int id;
	private String name;
	private String address;
	private Date date = new Date();
	private int basicSalary;
	
	abstract void sumSalary();
	public Employee(){
		this.id = 0;
		this.name = null;
		this.address = null;
		setdow(1,0,1950);
		this.basicSalary = 0;
	}
	public Employee(int id, String name, String address, int day, int month, int year, int basicSalary) {
		this.id = id;
		this.name = name;
		this.address = address;
		setdow(day, month, year);
		this.basicSalary = basicSalary;
	}
	public void setdow(int day, int month, int year) {
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(new Date());
		calendar.set(Calendar.MONTH, month-1);
		calendar.set(Calendar.DAY_OF_MONTH, day);
		calendar.set(Calendar.YEAR, year);
		this.setDate(calendar.getTime());
	}
	public int getDay() {
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(new Date());
		int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
		
		calendar.setTime(date);
		int workDay = calendar.get(Calendar.DAY_OF_MONTH);
		
		return currentDay - workDay;
	}
	public void display() {
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(date);
		SimpleDateFormat fm=new SimpleDateFormat("dd/MM/yyyy");
		String fmdated = fm.format(this.getDate());
		System.out.println(this.id +" -- "+ this.name +" -- "+ this.address + " -- "+ fmdated +" -- " + this.basicSalary);
	}
	
	public int getBasicSalary() {
		return basicSalary;
	}
	public void setBasicSalary(int basicSalary) {
		this.basicSalary = basicSalary;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
}
